fix(backend): standardize timezone handling to UTC ISO-8601#2033
Conversation
utksh1
left a comment
There was a problem hiding this comment.
Good technical improvement! Standardizes timezone handling to always use timezone-aware UTC with ISO-8601 formatting.
Key improvements:
✅ Added time_utils.py with shared UTC helpers (utc_now, parse_to_utc, to_utc_iso)
✅ Reports now emit consistent generated_at/discovered_at timestamps
✅ All datetime handling is timezone-aware
✅ Added unit tests for UTC parsing/formatting
This prevents timezone-related bugs and improves timestamp consistency across reports, findings, and API responses. All CI checks passed. Approved for merge.
|
Great work on this timezone standardization! The PR is approved, but needs a rebase with main due to conflicts: Conflicts:
Both conflicts are straightforward:
Once rebased, I'll merge immediately since it's already approved! |
Add shared time_utils helpers and use timezone-aware UTC with an explicit offset for generated_at and discovered_at across reports, findings API responses, and report generation. Closes utksh1#1882
Default to_utc_iso to timespec=auto so finding intelligence tests can compare against datetime.now(UTC). Update TLS verification mocks for crawler client.stream() and stub crawl_target in API scanner tests.
683843a to
396a889
Compare
Add shared time_utils helpers and use timezone-aware UTC with an explicit offset for generated_at and discovered_at across reports, findings API responses, and report generation.
Closes #1882
What changed
Added backend/secuscan/time_utils.py for shared UTC helpers
Reports now emit UTC ISO-8601 generated_at / discovered_at (with offset)
Findings/reports API responses normalize timestamps to UTC with offset
_parse_discovered_at always returns timezone-aware UTC
Added unit tests for UTC parsing/formatting + frontend date consistency